<include file="Public/min-header"/>
<style>
	.picture {
		line-height: 0;
		background-color: #FFF;
		text-align: center;
		vertical-align: middle;
		display: table-cell;
		width: 160px;
		height: 100px;
		margin: 0 auto;
		border: solid 1px #F5F5F5;
		overflow: hidden;
	}
	.picture img {
		max-width: 160px;
		max-height: 100px;
		margin-top: expression(100-this.height/2);
	}
</style>
<div class="wrapper">
	<include file="Public/breadcrumb"/>
	<section class="content" style="padding:0px 15px;">
		<!-- Main content -->
		<div class="container-fluid">
			<div class="pull-right">
				<a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
				<a onclick="get_help(this)" data-url="http://www.vyxjj.com?/Doc/Indexbbc/article/id/1064/developer/user.html" class="btn btn-default" href="javascript:;"><i class="fa fa-question-circle"></i> 帮助</a>
			</div>
			<div class="panel panel-default">
				<div class="panel-body ">
					<include file="store_setting_navtabs"/>
					<!--表单数据-->
					<form method="post" id="handlepost">
						<!--通用信息-->
						<div class="tab-content" style="padding:20px 0px;">
							<div class="tab-pane active" id="tab_tongyong">
								<div class="callout callout-inro">
									<p>1. 最多可上传5张幻灯片图片。</p>
									<p>2. 支持jpg、jpeg、png格式上传，建议图片750*360、大小1.00M以内的图片。提交2~5张图片可以进行幻灯片播放，一张图片没有幻灯片播放效果。</p>
									<p>3. 操作完成以后，按“提交”按钮，可以在当前页面进行幻灯片展示。</p>
								</div>
							</div>
							<div class="row" style="margin:20px auto;text-align:center;max-width:800px;">
								<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
									<ol class="carousel-indicators">
										<foreach name="store_slide" item="vo" key="k">
											<if condition="$vo neq ''">
												<li data-target="#carousel-example-generic" data-slide-to="{$k}" class=" <if condition='$k eq 0'>active</if>"></li>
											</if>
										</foreach>
									</ol>
									<div class="carousel-inner">
										<foreach name="store_slide" item="vo" key="k">
											<if condition="$vo neq ''">
												<div class="item <if condition='$k eq 0'>active</if>">
													<img height="250" src="{$vo}" alt="First slide">
													<div class="carousel-caption">
													</div>
												</div>
											</if>
										</foreach>
									</div>
									<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
										<span class="fa fa-angle-left"></span>
									</a>
									<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
										<span class="fa fa-angle-right"></span>
									</a>
								</div>
							</div>

							<div class="row col-md-12">

								<volist name="store_slide_url" id="value_u" key="key_u" >
									<div class="col-sm-4 col-md-2">
										<div class="thumbnail">
											<div class="picture"><img  id="srcpath_{$key_u}"  <empty name="store_slide[$key_u-1]">src="__PUBLIC__/images/not_adv.jpg"<else />src="{$store_slide[$key_u-1]}"</empty>>
												<input type="hidden" id="imgpath_{$key_u}" name="store_slide[]" value="{$store_slide[$key_u-1]}">
											</div>
											<div class="caption">

												<p>
													<select name="store_slide_url[]" class="ad_link input-sm" >
														<option value="0">请选择广告链接</option>
														<volist name="link" id="value" >
															<option value="{$key}" <if condition="$value_u.link eq $key">selected</if>>{$value}</option>
														</volist>
													</select>

													<span style="margin-left: 10px  <if condition="$value_u.id eq null"  > ;display:none</if> "    > Id： <input type="text"  class="form-control" name="objectId[]" value="{$value_u.id}" ></span>

												</p>
												<p><input type="button" class="btn btn-default" onClick="upload_img('{$key_u}')"  value="上传图片"/></p>
												<if condition="$store_slide[$key_u-1]">
													<p><input type="button" class="btn btn-default" onClick="del('imgpath_{$key_u}','srcpath_{$key_u}')"  value="删除图片"/></p>
												</if>
											</div>
										</div>
									</div>
								</volist>
							</div>
							<div class="row" style="text-align:center;"><a href="javascript:void(0)" onclick="adsubmit()" class="btn btn-info margin">提交设置</a></div>
						</div>
					</form><!--表单数据-->
				</div>
			</div>
		</div>
	</section>
</div>

<script>

	$(document).ready(function() {

		$(document).on('change','.ad_link',function() {
			var t = $(this);
			var  id = t.val();
			if (id == "/pages/goods_details/goods_details" ||　id == "/pages/store/index"){

				t.next().css('display','block');

			}else{
				t.next().css('display','none');
			}

		});

	});

	function del(item,imgItem){
		$('#'+item).val('')
		$('#'+imgItem).attr('src','/Public/images/not_adv.jpg')
	}

	function adsubmit(){
		$('#handlepost').submit();
	}

	function goset(obj){
		window.location.href = $(obj).attr('data-url');
	}
	var turn = 0;
	function upload_img(i){
		turn = i;
		GetUploadify(1,'store_logo','seller','callback');
	}

	function callback(img_str){
		$('#imgpath_'+turn).val(img_str);
		$('#srcpath_'+turn).attr('src',img_str);
	}
</script>
</body>
</html>